<?php
namespace app\model\admin;

use think\Db;

class Message
{
    //获取留言列表
    public function get_message_lists($where,$sort='',$paginate=10)
    {
        $result_lists = Db::name('message')->where($where)->order($sort)->paginate($paginate);
        return $result_lists;
    }

    //留言详情
    public function message_detail($message_id){
        $result = Db::name('message')->where('id',$message_id)->find();
        return $result;
    }

    //留言删除
    public function delete_message($array_id){
        $advert_delete = Db::name('message')->delete($array_id);
        return $advert_delete;
    }

    //获取文章数量
    public function get_message_num($where){
        $result = Db::name('message')->where($where)->count();
        return $result;
    }

    //留言添加
    public function add_message($data){
        $status = Db::name('message')->insert($data);
        return $status;
    }

}


